#include<iostream>
using namespace std;
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
const int N=1e4+10;
int w,m,n; 
int main(){
	scanf("%d%d%d",&w,&m,&n);
	m--;n--;
	int a=m/w,b=n/w;
	int ch=abs(b-a);
	int a1=m%w,b1=n%w;
	if(!a%2)a1=w-a1-1;
	if(!b%2)b1=w-b1-1;
	int ku=abs(b1-a1);
	int res=ch+ku;
	printf("%d",res); 
	return 0;
}
